{% load static %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>KNN分类</title>
    <base href="/">
    <link rel="SHORTCUT ICON" href="../static/img/icon.png">
    <link rel="stylesheet" type="text/css" href="../static/css/index.css"/>
    <link rel="stylesheet" type="text/css" href="../static/css/footer.css"/>
    <link rel="stylesheet" type="text/css" href="../static/css/dataAnalysis.css"/>
    <script type="text/javascript" src="../static/js/jquery.js"></script>
    <style>
        a {
            text-decoration: none;
        }

        body {
            background: #F6F8FA;
        }


        .nav {
            background-color: #34495e;
            height: 80px;
            width: 1330px;
            margin-left: 5px;
            margin-right: 5px;

        }

        .main-middle {
            height: 508px;
            background-color: #ffffff;
            margin-top: 5px;
            margin-left: 7px;
            margin-right: 12px;
        }

        .footer {
            width: 1330px;
            background-color: #34495e;
            margin-top: 5px;
            height: 80px;
            margin-left: 7px;
            margin-bottom: 5px;
        }

        .logo {
            width: 250px;
            height: 80px;
            background-color: #aee6a6;
            margin-left: 10px;
        }

        .logo img {
            width: 250px;
            height: 80px;
        }

        .content_left {
            background-color: #f2f2f2;
            width: 300px;
            height: 505px;
            float: left;
        }

        .upload_file {
            width: 290px;
            height: 110px;
            background-color: #dfdfdf;
            margin-left: 5px;
            text-align: center;
        }

        .select {
            width: 290px;
            height: 190px;
            background-color: #dfdfdf;
            margin-left: 5px;
            text-align: center;
            margin-top: 5px;
        }

        .download {
            width: 290px;
            height: 90px;
            background-color: #dfdfdf;
            margin-left: 5px;
            text-align: center;
            margin-top: 5px;
        }

        .content_right {
            background-color: #f2f2f2;
            height: 500px;
            width: 1023px;
            margin-left: 5px;
            margin-right: 2px;
            float: right;
            margin-top: 5px;
        }

        .content_right {
            text-align: center;
        }

        .data_table tr:nth-child(n+1) {
            background: #a6d481;
        }

        .data_table tr:nth-child(2n) {
            background: #d5eecc;
        }

        .show_data {
            margin-left: 5px;
            margin-top: 5px;
            background-color: #F8FCFD;
            width: 1000px;
            height: 280px;
            overflow-x: auto;
            overflow-y: auto;
        }

        .show_data {
            margin-left: 5px;
            margin-top: 5px;
            background-color: #FFF;
            width: 1000px;
            height: 280px;
            overflow-x: auto;
            overflow-y: auto;

        }

        .show_data {
            margin-left: 5px;
            margin-top: 5px;
            background-color: #FFF;
            width: 1000px;
            height: 280px;
            overflow-x: auto;
            overflow-y: auto;
        }

        .data_detail {
            margin-left: 5px;
            background-color: #F8FCFD;
            width: 1000px;
            height: 150px;
            margin-top: -40px;

        }

        .data_table {
            white-space: nowrap;
        }

        .data_distribution {
            margin-left: 5px;
            margin-top: 5px;
            background-color: #f2f2f2;
            width: 1000px;
            height: 450px;
            margin-top: -18px;
        }

        .right_img img {
            width: 490px;
            height: 330px;
        }

        .left_img img {
            width: 490px;
            height: 330px;
        }

        .show_img img {
            width: 600px;
            height: 400px;
            margin-top: 5px;
        }

        /** Table 表格样式 **/
        .data_table {
            border-collapse: collapse;
            width: 100%;
            border: 1px solid #c6c6c6 !important;
            margin-bottom: -35px;
        }

        .data_table th {
            border-collapse: collapse;
            border-right: 1px solid #c6c6c6 !important;
            border-bottom: 1px solid #c6c6c6 !important;
            background-color: #ddeeff !important;
            padding: 5px 9px;
            font-size: 14px;
            font-weight: normal;
            text-align: center;
        }

        .data_table td {
            border-collapse: collapse;
            border-right: 1px solid #c6c6c6 !important;
            border-bottom: 1px solid #c6c6c6 !important;
            padding: 5px 9px;
            font-size: 12px;
            font-weight: normal;
            text-align: center;
            word-break: break-all;
        }

        .data_table tr:nth-child(odd) {
            background-color: #fff !important;
        }

        .data_table tr:nth-child(even) {
            background-color: #f8f8f8 !important;
        }

        .data_table1 {
            margin-top: 50px;
        }

        .update:hover {
            background-color: #4687b1;
        }

        .update {
            width: 110px;
            height: 30px;
            cursor: pointer;
            font-size: 14px;
            border-radius: 2px;
            border: none;
            background-color: #4ca2ec;
            color: #fff;
            line-height: 30px;
            margin-top: 5px;
        }

        .download input {
            width: 110px;
            height: 30px;
            cursor: pointer;
            font-size: 14px;
            border-radius: 2px;
            border: none;
            background-color: #4ca2ec;
            color: #fff;
            line-height: 30px;
            margin-top: 5px;
        }

        select {
            padding: 3px;
            width: 138px;
            float: left;
            border-radius: 1px;
            font-size: 14px;
            font-weight: 300;
            margin-top: 5px;
            margin-bottom: 5px;
        }

        .download input:hover {
            background-color: #4687b1;
        }

        .knn:hover {
            background-color: #4687b1;
        }

        .knn {
            width: 110px;
            height: 30px;
            cursor: pointer;
            font-size: 14px;
            border-radius: 2px;
            border: none;
            background-color: #4ca2ec;
            color: #fff;
            line-height: 30px;
            margin-top: 5px;
        }

        input:focus {
            border-color: #66afe9;
            outline: 0;
            -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
            box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6)
        }

        .user_input {
            outline-style: none;
            border: 1px solid #ccc;
            border-radius: 4px;
            padding: 3px;
            width: 130px;
            font-size: 14px;
            font-weight: 300;
        }
    </style>
</head>
<body>
<div class="nav">
    <div class="logo">
        <img src="../static/img/logo.jpg">
    </div>
</div>
<nav>
    <!--导航条-->
    <ul class="nav-main">
        <li><a href="/">首页</a></li>
        <li id="li-1">在线数据分析<span></span></li>
        <li id="li-2">数据社区<span></span></li>
        <li id="li-3">数据可视化<span></span></li>
        <li><a href="/contact/">关于我们</a></li>
        <li><a href="/help/">帮助中心</a></li>
    </ul>
    <div id="box-1" class="hidden-box hidden-loc-index">
        <ul>
            <li><a href="/analysis/">数据分析</a></li>
        </ul>
    </div>
    <div id="box-2" class="hidden-box hidden-loc-us">
        <ul>
            {% for catagory in allcategory %}
                <li><a href="{% url 'index' %}blog/list{{ catagory.id }}">{{ catagory.nama }}</a></li>
            {% endfor %}
        </ul>
    </div>
    <div id="box-3" class="hidden-box hidden-loc-info">
        <ul>
            <li><a href="/visualization/bar/">数据可视化</a></li>
        </ul>
    </div>
</nav>
<div class="main-middle">
    <div class="content_left">
        <div class="upload_file">
            <h4 style="margin-bottom: 5px">上传CSV数据集</h4>
            <form action="/dataAnalysis/show_knn/" method="post" enctype="multipart/form-data">
                {% csrf_token %}
                <input type="file" required name="csv_file">
                <p></p>
                <input type="submit" class="update" value="上传CSV数据集">
                <p style="color: #2fc947">{{ message }}</p>
            </form>
        </div>
        <div class="select">
            <h4 style="margin-bottom: 5px">KNN分类</h4>
            <form action="/dataAnalysis/knn_handle/" method="post">
                {% csrf_token %}
                <table border="0" cellspacing="0" cellpadding="0" style="margin: auto;font-size: 14px;">
                    <tr>
                        <td>入图表标题</td>
                        <td><input style="margin-bottom: 5px" required class="user_input" type="text" name="title"
                                   placeholder="输入图表标题"></td>
                    </tr>
                    <tr>
                        <td>输入K值</td>
                        <td><input style="margin-bottom: 5px" required class="user_input" type="text" name="k_value"
                                   placeholder="输入K值"></td>
                    </tr>
                    <tr>
                        <td>入测试数据</td>
                        <td><input style="margin-bottom: 5px" required class="user_input" type="text" name="test_data"
                                   placeholder="输入测试数据"></td>
                    </tr>
                    <tr>
{#                        <td>#}
{#                            <select name="chart_values">#}
{#                                <option selected="selected">选择图表类型</option>#}
{#                                <option value="matrix">矩阵图</option>#}
{#                                <option value="bar">柱状图</option>#}
{#                            </select>#}
{#                        </td>#}
                        <td><input class="knn" type="submit" value="确认"></td>
                    </tr>
                </table>
                <p style="color: #35c949">{{ msg }}</p>
            </form>
        </div>

        <div class="download">
            <h4 style="margin-bottom: 5px">导出CSV数据集</h4>
            <p></p>
            <form action="/dataAnalysis/download/" method="post">
                {% csrf_token %}
                <input type="submit" value="导出CSV数据集"/>
            </form>
        </div>

    </div>
    <div class="content_right">
        <div class="show_data">
            {#            {{ df1 }}#}
            <table border="0" cellspacing="0" cellpadding="0" width="950px" height="250px" class="data_table">
                <caption>数据预览</caption>
                {% for line in test_data %}
                    <tr>
                        {% for i in line %}
                            <td>{{ i }}</td>
                        {% endfor %}
                    </tr>
                {% endfor %}
            </table>
        </div>
        <div class="data_detail">
            <table border="1" cellspacing="0" cellpadding="0" width="500px" height="100px"
                   class="data_table data_table1">
                <caption>KNN分类结果</caption>
                <tr>
                    <td>你输入的数据分类结果为</td>
                    <td>{{ knn_result }}</td>
                </tr>
                <tr>
                    <td>训练集长度</td>
                    <td>{{ Train_set }}</td>
                </tr>
                <tr>
                    <td>测试集长度</td>
                    <td>{{ Test_set }}</td>
                </tr>
            </table>
        </div>
{#        <div class="data_distribution">#}
{#            <div class="show_img">#}
{#                <img src="{{ src }}" alt="图表"/>#}
{#            </div>#}
{#        </div>#}
    </div>
</div>
<div class="footer">
    <footer style="border-top: 1px solid ; background-repeat: repeat;"
            class="footer">
        <div class="footer-inner">
            <div class="fooert copyright" align="center">
                <a href="##" target="_blank">友情链接：</a>
                <a href="https://www.django.cn/" target="_blank">Django中文网</a>
                | <a href="https://www.runoob.com/" target="_blank">菜鸟教程</a>
                | <a href="http://pyecharts.org/#/zh-cn/" target="_blank">pyecharts</a> |
                <a href="http://sc.chinaz.com/tag_jiaoben/tupianlunbo.html" rel="sitemap">站长素材</a>
                | <a href="##" target="_blank">联系我们</a>
                <p><a href="/" title="dry">dry</a> 版权所有，保留一切权利 ! <a href="https://www.kkkuu.cn/">首页</a> © 2019-2020 ·
                    黔ICP备00000000号</p>
            </div>
    </footer>
</div>
<script src="../static/js/index.js"></script>
</body>
</html>